<%@ Control Language="C#" AutoEventWireup="true" CodeFile="RegistrationBox.ascx.cs" 
    Inherits="control_RegistrationBox" EnableViewState="false" %>

<%@ Register Src="~/control/rounded_box/RoundedBox.ascx" TagPrefix="ucc" TagName="RoundedBox" %>

<ucc:RoundedBox ID="signupBox" runat="server" Theme="gray">
    <RoundBoxTemplate>
        <asp:Panel ID="pnlRegistration" runat="server" DefaultButton="register">
        <table width="250px">
            <tr>
                <td align="left" colspan="2">
                    <asp:ValidationSummary ID="responseMessage" runat="server" EnableClientScript="true"
                        DisplayMode="BulletList" ValidationGroup="signupValidation" />
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <h5>New User Registration:</h5>
                </td>
            </tr>
            <tr>
                <td>
                    Email:
                </td>
                <td>
                    <asp:TextBox ID="userName" runat="server" MaxLength="50" Text="example@domain.com" 
                        Width="130px" SkinID="LightRedText"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="userNameRequired" ControlToValidate="userName" runat="server"
                        Display="Dynamic" Text="*" ErrorMessage="Email Required" ValidationGroup="signupValidation">
                    </asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="emailValidate" ControlToValidate="userName" runat="server"
                        Display="Dynamic" Text="*" ErrorMessage="Invalid Email" ValidationGroup="signupValidation">
                    </asp:RegularExpressionValidator>
                    <asp:CustomValidator ID="validateRegistration" runat="server" Text="*" 
                        ControlToValidate="userName" Display="Dynamic" ValidationGroup="signupValidation"
                        OnServerValidate="validateRegistration_Validate" ErrorMessage="Email is already registered">
                    </asp:CustomValidator>
                </td>
            </tr>
            <tr>
                <td>
                    Password:
                </td>
                <td>
                    <asp:TextBox ID="password" runat="server" TextMode="Password" MaxLength="50" Width="130px"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="passwordRequired" ControlToValidate="password" runat="server"
                        Display="Dynamic" Text="*" ErrorMessage="Password Required" ValidationGroup="signupValidation">
                    </asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="passwordValidate" ControlToValidate="password" runat="server"
                        Display="Dynamic" Text="*" ErrorMessage="Password Should Be Alphanumeric" 
                        ValidationGroup="signupValidation">
                    </asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
                <td>
                    Retype Password:
                </td>
                <td>
                    <asp:TextBox ID="rePassword" runat="server" TextMode="Password" MaxLength="50" Width="130px"></asp:TextBox>
                    <asp:CompareValidator ID="comparePassword" runat="server" Display="Dynamic" Text="*"
                        ErrorMessage="Passwords do not match" ControlToValidate="rePassword" 
                        ControlToCompare="password" ValidationGroup="signupValidation">
                    </asp:CompareValidator>
                </td>
            </tr>
            <tr>
                <td>&nbsp;</td>
                <td>
                    <asp:CheckBox runat="server" ID="agreedTerms" Text=" I agree terms" />
                </td>
            </tr>
            <tr>
                <td>&nbsp;</td>
                <td>
                    <asp:ImageButton ID="register" runat="server" OnClick="register_Click" 
                        AlternateText="Sign up" ValidationGroup="signupValidation" />
                </td>
            </tr>
        </table>
        </asp:Panel>
    </RoundBoxTemplate>
</ucc:RoundedBox>
